#define  _CRT_SECURE_NO_WARNINGS 1




#include <stdio.h>

void toOctal(int num) {
    int octalNum[100];
    int i = 0;
    while (num != 0) {
        octalNum[i] = num % 8;
        num = num / 8;
        i++;
    }
    for (int j = 0; j <i; j++) {
        printf("%d", octalNum[j]);
    }
}

int main() {
    int decimalNum;
    scanf("%d", &decimalNum);
    toOctal(decimalNum);
    return 0;
}